package com.opengate.demo.api.base.mq;

import com.opengate.base.stream.RepOutput;
import com.opengate.demo.contact.message.DemoMessage;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.stream.messaging.Source;
import org.springframework.stereotype.Component;

/**
 * @author 曳戈泰尔
 * @version 1.0
 * @description 发送mq
 * @date 2023/4/27 8:59 PM
 */
@Slf4j
@Component
public class DemoSendMq {

    /** 构造函数方式注入 */
    private final Source source;

    private final RepOutput repOutput;

    @Autowired
    public DemoSendMq(Source source, RepOutput repOutput) {
        this.source = source;
        this.repOutput = repOutput;
    }

    public void sendDemoMessage(DemoMessage message) {
        message.send(source);
    }

    public void sendRepDemoMessage(DemoMessage message) {
        message.send(repOutput);
    }
}
